/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package collision;

import java.util.ArrayList;
import javax.swing.ImageIcon;

/**
 *
 * @author marinacv
 */
public class Charmander extends Pokemon{

    private String pokemon = "/Sprites/charmander.gif";

    public Charmander(){
    }

        public Charmander(int x, int y) {
        ImageIcon ii = new ImageIcon(this.getClass().getResource(this.pokemon));
        setImage(ii.getImage());
        setWidth(getImage().getWidth(null));
        setHeight(getImage().getHeight(null));
        setMissiles(new ArrayList());
        setVisible(true);
        setImagew(23);
        setImagex1(0);
        System.out.println("x =" + x +"  y =" + y);
        setX(x);
        setY(y);
    }
    @Override
    public void move() {
        if(this.getImagex1() != 2* this.getImagew())
            this.setImagex1(this.getImagex1() + this.getImagew());
        else this.setImagex1(0);

        this.setX(this.getX() + this.getDx());
        this.setY(this.getY() + this.getDy());

        if (this.getX() < 1) {
            this.setX(1);
        }

        if (this.getY() < 1) {
            this.setY(1);
        }
    }

    @Override
    public void move(int i) {
        if( i%50 == 0)
            if(this.getImagex1() != 2* this.getImagew())
            this.setImagex1(this.getImagex1() + this.getImagew());
            else this.setImagex1(0);

       this.setX(this.getX() + this.getDx());
        this.setY(this.getY() + this.getDy());

        if (this.getX() < 1) {
            this.setX(1);
        }

        if (this.getY() < 1) {
            this.setY(1);
        }

        if(i % this.getMISSILEDELAY() == 0){
            fire();
        }
    }

    }

